import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../views/Layout'
import Login from '../views/Login'
import Home from '../views/Home'
import Category from '../views/Category'
import Product from '../views/Product'
import Cart from '../views/Cart'
import Checkout from '../views/Checkout'
import Pay from '../views/Pay'
import Result from '../views/Result'
import Goods from '../views/goods'

const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '',
        component: Home
      },
      {
        path: 'category/:id',
        component: Category
      },
      {
        path: '/good/:id',
        component: Goods
      },
      {
        path: 'product/:id',
        component: Product
      },
      {
        path: 'cart',
        component: Cart
      },
      {
        path: 'checkout',
        component: Checkout
      },
      {
        path: 'pay',
        component: Pay
      },
      {
        path: 'pay/result',
        component: Result
      }
    ]
  },
  {
    path: '/login',
    component: Login
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
